#ifndef __QT_DATABASE_IP_DIALOG_H__
#define __QT_DATABASE_IP_DIALOG_H__

#include <QVariant>
#include <QAction>
#include <QApplication>
#include <QButtonGroup>
#include <QComboBox>
#include <QDialog>
#include <QDialogButtonBox>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QHeaderView>
#include <QLabel>
#include <QLineEdit>
#include <QSpacerItem>
#include <QVBoxLayout>



typedef struct tag_db_connect
{
  QString  addr;
  int      port;

  QString  database_name;
  QString  database_login;
  QString  database_pswd;
}db_connect;


class DatabaseIpDalog : public QDialog
{
    Q_OBJECT
public:
    explicit DatabaseIpDalog(QWidget *parent = 0);
    virtual ~DatabaseIpDalog();

    virtual void buildWidget(const QList<QString> &dbname,
                             const QString        &def_dbname = "",
                             const QString        &username   = "",
                             const QString        &userpswd   = "",
                             const QString        &addr       = "",
                             const int            &port       =0);


signals:
    void dbloginaccept(db_connect);

public slots:
    virtual void accept();
    virtual void reject ();

protected:
    QVBoxLayout          *verticalLayout;
    QGroupBox            *databaseGroupBox;
    QVBoxLayout          *databaseVerticalLayout;
    QComboBox            *databaseComboBox;
    QHBoxLayout          *databaseLoginHL;
    QLabel               *loginLabel;
    QLineEdit            *loginLineEdit;
    QLabel               *passwordLabel;
    QLineEdit            *passwordLineEdit;
    QGroupBox            *dbAddressGroupBox;
    QHBoxLayout          *horizontalLayout;
    QLabel               *addressLabel;
    QLineEdit            *addressLineEdit;
    QSpacerItem          *addressPortHSpacer;
    QLabel               *portLabel;
    QLineEdit            *portLineEdit;
    QDialogButtonBox     *buttonBox;


};

#endif // __QT_DATABASE_IP_DIALOG_H__
